.\"
.\" Copyright (c) 2010-2019 Julien Nadeau Carriere <vedge@csoft.net>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 27, 2010
.Dt SG_PROGRAM 3
.Os
.ds vT Agar API Reference
.ds oS Agar 1.6
.Sh NAME
.Nm SG_Program
.Nd Agar-SG vertex/fragment program
.Sh SYNOPSIS
.Bd -literal
#include <agar/core.h>
#include <agar/sg.h>
.Ed
.Sh DESCRIPTION
The
.Nm
object represents a generic vertex or pixel shader program.
Applications will rarely use the
.Nm
interface directly, since programs in specific languages will use
subclasses such as
.Xr SG_CgProgram 3 .
.Sh INHERITANCE HIERARCHY
.Xr AG_Object 3 ->
.Nm .
.Sh INTERNAL WIDGET API
The following functions are used by
.Xr SG_View 3
(or derived widgets), when rendering a scene.
.Pp
.nr nS 1
.Ft "int"
.Fn SG_ProgramInstall "SG_Program *prog" "SG_View *view"
.Pp
.Ft "void"
.Fn SG_ProgramDeinstall "SG_Program *prog" "SG_View *view"
.Pp
.Ft "void"
.Fn SG_ProgramBind "SG_Program *prog" "SG_View *view"
.Pp
.Ft "void"
.Fn SG_ProgramUnbind "SG_Program *prog" "SG_View *view"
.Pp
.nr nS 0
The
.Fn SG_ProgramInstall
function installs the program defined in
.Fa prog .
This generally involves verifying, compiling and uploading the code to
the hardware.
The program is not effective until bound.
.Pp
.Fn SG_ProgramDeinstall
deinstalls / releases the program defined in
.Fa prog .
.Pp
.Fn SG_ProgramBind
binds the program defined in
.Fa prog
to the current scene.
.Pp
.Fn SG_ProgramUnbind
unbinds the program defined in
.Fa prog
from the current scene.
.Sh SEE ALSO
.Xr SG 3 ,
.Xr SG_CgProgram 3 ,
.Xr SG_Intro 3 ,
.Xr SG_View 3
.Sh HISTORY
The
.Nm
object class first appeared in Agar 1.6.0.
